const app = getApp();
Page({
  data: {

  },
  formSubmit:function(e){
    app.getFormid(e);
  },
  getuserinfo:function(e){
    var that = this;
    wx.getUserInfo({
      lang: 'zh_CN',
      success: function (res) {
        let open_id = wx.s=wx.getStorageSync('open_id');
        var userInfo = res.rawData;
        app.request('login/addUser',{
          userInfo, open_id
        },'POST',false,function(res){
          if(res.data.code == 1){
            wx.showToast({
              title: '授权成功！',
              icon: 'success'
            })
            wx.setStorageSync('isSetting', true)
            let getPhone = wx.getStorageSync('getPhone') || false;
            if (getPhone){
              setTimeout(function () {
                wx.navigateBack({
                  delta: 1,
                })
              }, 1000)
            }else{
              wx.redirectTo({
                url: '/pages/account/phone/phone',
              })
            }
          }else{
            wx.showToast({
              title: '授权失败！',
              icon: 'none'
            })
          }
        })
      },
      fail:function(res){
        wx.showToast({
          title: '调用个人信息失败！',
          icon: 'none'
        })
      }
    })
  },
  cancle:function(){
    var that = this;
    wx.navigateBack({
      delta: 1,
    })
  },
  onLoad: function () {
    var that = this;
    app.request('base/getRoutineSet', {
      
    }, 'POST', false, function (res) {
      that.setData({
        info:res.data
      })
    })
  }
})